import {
  Component,
  OnInit,
  OnDestroy,
  QueryList,
  ViewChildren,
  Input,
  ViewChild,
} from '@angular/core';
import { ActivatedRoute, Params } from '@angular/router';
import { ApiService } from '@core/services/http/api.service';
import { Events } from '@core/services/events/Events';
import { CompanyModalComponent } from "../../../analysis/company-modal/company-modal.component";
import { CarTableComponent } from '../car-table/car-table.component';
import { ApesMessageService } from '@shared/apes/message';
import { CarStepComponent } from '../car-step/car-step.component';
import { ProPanelComponent } from './control-pro/pro-panel/pro-panel.component';
import { ProMinutiaComponent } from './control-pro/pro-minutia/pro-minutia.component';
import * as CryptoJS from 'crypto-js';
import { ServiceProComponent } from './service-pro/service-pro.component';
import { UserAuthService } from '@core/services/user-auth.service';
import { DatePipe } from '@angular/common';

@Component({
  selector: 'car-list',
  templateUrl: './car-list.component.html',
  styleUrls: ['./car-list.component.scss'],
})
export class CarListComponent implements OnInit, OnDestroy {
  @ViewChildren(CarTableComponent) childCmps: QueryList<CarTableComponent>;
  @ViewChildren(ProPanelComponent) childPanel: QueryList<ProPanelComponent>;
  @ViewChildren(ProMinutiaComponent) childMinutia: QueryList<ProMinutiaComponent>;
  @ViewChild(CarStepComponent,{static:true}) childStep: CarStepComponent;
  @ViewChild(ServiceProComponent,{static:true}) childService: ServiceProComponent;

  /* 按钮相关 */
  buttonBar: any = [];
  title = '';
  ctx = { model: {} };

  parmes: any;

  // 车辆总控报表 带的数据
  // titleData = {};
  headOne = {};
  headTwo = {};
  headThe = {};
  checkId: any;
  topList: any [];                // 头部信息
  checkKeys: string = '1';
  cphm: any;
  mdid: any;

  selectIndex: number;
  vipVisible: boolean = false;
  carVisible: boolean = false;

  timeOut: any;
  disable: boolean = true;
  userInfo = this.userAuthService.getUserInfoObj();
  review: string;
  reviewData: any;

  constructor(private routeInfo: ActivatedRoute,
              private event: Events,
              private apiService: ApiService,
              private msg: ApesMessageService,
              private userAuthService: UserAuthService,
              private datePipe: DatePipe) {
    this.buttonBar = [{ hide: true, style: 'default', label: '编辑', id: 'action_query', loading: false }];
  }

  ngOnInit() {
    //  解密
    this.routeInfo.queryParams.subscribe((params: Params) => {
      let value = CryptoJS.enc.Base64.parse(params['value']);
      value = value.toString(CryptoJS.enc.Utf8);
      this.parmes = JSON.parse(value);

      this.getHeadData(this.parmes.JJCDH, this.parmes.CPHM, this.parmes.MDID);
      this.checkId = this.parmes.JJCDH;
      this.cphm = this.parmes.CPHM;
      this.mdid = this.parmes.MDID;
      this.topList = this.setHeadData();

      this.timeOut = setTimeout(() => {
        this.getComment(this.parmes.JCID);
        this.getCheck(this.parmes.JJCDH, this.parmes.CPHM, this.parmes.MDID, this.checkKeys);
      }, 100);
    });
  }

  onEvent(data: any) {
    if (data instanceof MouseEvent) return;
    if (data) {
      if (data.id === 'action_save') {
        this.action_save();
      }
    }
  }

  action_save() {
    this.setComment();
  }

  vipOpen() {
    this.vipVisible = true;
  }

  vipClose() {
    this.vipVisible = false;
  }

  carOpen() {
    this.carVisible = true;
  }

  carClose() {
    this.carVisible = false;
  }

  getKeys(key: string) {
    this.getCheck(this.checkId, this.cphm, this.mdid, key);
  }

  getCheck(key: string, cphm: string, mdid: string, checkKeys: string) {
    // this.childStep.getFun(key, cphm, mdid, checkKeys);
    this.childService.getData(key, cphm, mdid);
    let childData = this.childCmps['_results'];
    for (let i = 0, len = childData.length; i < len; i++) {
      childData[i].getFun(key, cphm, mdid, checkKeys);
    }
    let childPanel = this.childPanel['_results'];
    for (let i = 0, len = childPanel.length; i < len; i++) {
      childPanel[i].getFun(key, cphm, mdid);
    }
    let childMinutia = this.childMinutia['_results'];
    for (let i = 0, len = childMinutia.length; i < len; i++) {
      childMinutia[i].getFun(key, cphm, mdid);
    }
  }

  getHeadData(api: any, cphm?: any, mdid?: any) {
    let data = {
      'interfaceMethod': 'ipmCLZKForAppService.getLeftTotal',
      'pdata': { 'JJCDH': api, 'CPHM': cphm, 'MDID': mdid, 'ZDZT': true },
    };
    this.apiService.post('report.interface', { 'body': JSON.stringify(data) }).subscribe(
      (resultData) => {
        const result = JSON.parse(resultData);
        if (result.success) {
          if (result.obj.length !== 0) {
            let data = JSON.parse(result.obj);
            if (data.length <= 1) {
              for (let i = 0, len = data.length; i < len; i++) {
                data[i]['JCBEYONDTIME'] = this.toHour(data[i]['JCBEYONDTIME']);
                data[i]['VIP'] = '(' + data[i]['VIPID'] + ')' + data[i]['VIPMC'];
              }
              this.headOne = data[0];
              this.headTwo = data[0];
              this.headThe = data[0];
            } else {
              this.headOne = {};
              this.headTwo = {};
              this.headThe = {};
            }
          }
        } else {
          this.msg.info(result.msg);
        }
      });
  }

  // 脑袋数据
  setHeadData() {
    return [
      {
        headOne: [
          { key: '车牌号', feild: 'CPHM' },
          { lable: '门店', feild: 'MDMC' },
          { lable: '车型', feild: 'CHXMC' },
          { key: '会员', feild: 'VIP' },
        ],
        headTwo: [
          { lable: '车辆状态', feild: 'JD' },
          { lable: '预计交车时间', feild: 'YJJCRQ_SJ' },
          { lable: '交车超时', feild: 'JCBEYONDTIME' },
          { lable: '车在哪', feild: 'CARPLACEMC' },
        ],
        headThe: [
          { lable: '项目', feild: 'FWLXMC' },
          { lable: '定损进度', feild: 'DSJDMC' },
          { lable: '配件进度', feild: 'PJJDMC' },
          { lable: '年审进度', feild: 'NSJDMC' },
          { lable: '返修车', feild: 'FXCMC' },
        ],

      }];
  }

  // 综合评论获取
  getComment(JCID: string) {
    let data = { 'interfaceMethod': 'ipmCLZKForAppService.qryCarcontrolYY', 'pdata': { 'JCID': JCID } };
    this.apiService.post('report.interface', { 'body': JSON.stringify(data) }).subscribe(
      (resultData) => {
        const result = JSON.parse(resultData);
        if (result.success) {
          if (result.obj.length !== 0) {
            let data = JSON.parse(result.obj);
            if (data.length > 0) {
              data = data.sort(this.sortarr('LRRQ_SJ'));
              this.reviewData = data;
            }
          }
        } else {
          this.msg.info(result.msg);
        }
      });
  }

  // 保存 综合评论
  setComment() {
    let data = {
      'interfaceMethod': 'ipmCLZKForAppService.exec_carcomtrolYY',
      'pdata': {
        'CZBJ': 0, 'JCID': this.parmes.JCID, 'CPHM': this.parmes.CPHM, 'JLRID': this.userInfo.userAccount.userId,
        'JLRMC': this.userInfo.userAccount.name, 'JLYY': this.review,
      },
    };
    this.apiService.post('report.interface', { 'body': JSON.stringify(data) }).subscribe(
      (resultData) => {
        const result = JSON.parse(resultData);
        if (result.success) {
          if (result.obj.length !== 0) {
            let data = JSON.parse(result.obj);
            // console.log(data)
            this.getComment(this.parmes.JCID);
          }
        } else {
          this.msg.info(result.msg);
        }
      });
  }

  //显示时间 天/小时   小时/分钟  分钟
  toHour(minutes) {
    if (Math.floor(minutes / 60 / 24) >= 1) {
      return (Math.floor(minutes / 60 / 24) + '天' + Math.floor(minutes / 60 % 24) + '小时');
    } else if (Math.floor(minutes / 60 / 24) < 1) {
      if (Math.floor(minutes) < 60) {
        return (Math.floor(minutes % 60) + '分钟');
      }
      if (Math.floor(minutes % 60) === 0) {
        return (Math.floor(minutes / 60) + '小时');
      }
      return (Math.floor(minutes / 60) + '小时' + Math.floor(minutes % 60) + '分钟');
    }
  }

  showTime(params) {
    let key = params.colDef.field;
    let data = params.data[key];
    if (Math.floor(data / 60 / 24) >= 1) {
      if (Math.floor(data / 60 / 24) < 10) {
        return (Math.floor(data / 60 / 24) + '天');
      }
      return (Math.floor(data / 60 / 24) + '天');
    } else if (Math.floor(data / 60 / 24) < 1) {
      if (Math.floor(data) < 60) {
        return (Math.floor(data % 60) + '分钟');
      }
      return (Math.floor(data / 60) + '小时');
    }
  }

  sortarr(key) {
    return function(a, b) {
      a[key] == undefined ? a[key] = 0 :
        b[key] == undefined ? b[key] = 0 : 0;
      return b[key] - a[key];
    };
  }

  timeChange(time: number) {
    let day;
    if (time !== undefined) {
      day = this.datePipe.transform(new Date(time),
        'yyyy-MM-dd HH:mm:ss').slice(5, 16);
      return day;
    }
  }

  ngOnDestroy() {
    clearInterval(this.timeOut);
  }


  /** ******************************************************************************************************* **/
  cryData = [
    {
      api: 'ipmCLZKForAppService.qryNXHEAD',
      tableApi: 'ipmCLZKForAppService.qryNXDetail',
      title: '内协调度',
      tableData: [
        { headerName: '节点', field: 'JDMC', width: 115 },
        { headerName: '负责人', field: 'ZRR', width: 115 },
        { headerName: '工时', field: 'GS', width: 140 },
        { headerName: '开始时间', field: 'KSRQ_SJ', width: 120 },
        { headerName: '耗时', field: 'HS', width: 150 },
        { headerName: '超时', field: 'CS', width: 135 },
        { headerName: '预计完成时间', field: 'YJWCRQ_SJ', width: 160 },
        { headerName: '完成时间', field: 'WCRQ_SJ', width: 100 },
        { headerName: '原因反馈', field: 'YUANYIN', width: 120 },
      ],
    },
    {
      api: 'ipmCLZKForAppService.qryCJHead',
      tableApi: 'ipmCLZKForAppService.qryCJStepOne',
      // infoApi: 'ipmCLZKForAppService.qryCJYY',
      title: '拆检',
      tableData: [
        { headerName: '单据类型', field: 'LYDJMC', width: 110 },
        { headerName: '单号', field: 'LYDJHM', width: 125 },
        { headerName: '开始时间', field: 'KSRQ_SJ', width: 135 },
        { headerName: '工时', field: 'GS', width: 135 },
        { headerName: '耗时', field: 'HS', width: 125 },
        { headerName: '超时', field: 'CS', width: 150 },
        { headerName: '下一步', field: 'XYBSM', width: 130 },
        { headerName: '预计完成时间', field: 'YJWCRQ_SJ', width: 135 },
        { headerName: '完成时间', field: 'WCRQ_SJ', width: 120 },
      ],
      // infotable: [
      //   { headerName: '节点', field: 'DJLXMC', width: 90 },
      //   { headerName: '负责人', field: 'LYDJHM', width: 90 },
      //   { headerName: '工时', field: 'GS', width: 90 },
      //   { headerName: '开始时间', field: 'KSRQ_SJ', width: 90 },
      //   { headerName: '耗时', field: 'HS', width: 90 },
      //   { headerName: '超时', field: 'CS', width: 90 },
      //   { headerName: '预计完成时间', field: 'YJWCRQ_SJ', width: 90 },
      //   { headerName: '完成时间', field: 'WCRQ_SJ', width: 90 },
      // ],
    },
    {
      api: 'ipmCLZKForAppService.qryZDHead',
      tableApi: 'ipmCLZKForAppService.qryZDYY',
      title: '诊断',
      tableData: [
        { headerName: '操作人', field: 'RY', width: 100 },
        { headerName: '录入时间', field: 'SJ', width: 130 },
        { headerName: '原因', field: 'YUANYIN', width: 800 },
        // { headerName: '工时', field: 'GS', width: 135 },
        // { headerName: '耗时', field: 'HS', width: 125 },
        // { headerName: '超时', field: 'CS', width: 150 },
        // { headerName: '下一步', field: 'XYBSM', width: 130 },
        // { headerName: '预计完成时间', field: 'YJWCRQ_SJ', width: 135 },
        // { headerName: '完成时间', field: 'WCRQ_SJ', width: 120 },
      ],
      // infotable: [
      //   { headerName: '节点', field: 'DJLXMC', width: 90 },
      //   { headerName: '负责人', field: 'LYDJHM', width: 90 },
      //   { headerName: '工时', field: 'GS', width: 90 },
      //   { headerName: '开始时间', field: 'KSRQ_SJ', width: 90 },
      //   { headerName: '耗时', field: 'HS', width: 90 },
      //   { headerName: '超时', field: 'CS', width: 90 },
      //   { headerName: '预计完成时间', field: 'YJWCRQ_SJ', width: 90 },
      //   { headerName: '完成时间', field: 'WCRQ_SJ', width: 90 },
      // ],
    },
    {
      api: 'ipmCLZKForAppService.getDSJDDetails',
      tableApi: 'ipmCLZKForAppService.getCarForDSJD',
      infoApi: 'ipmCLZKForAppService.getDSJDXX',
      title: '定损报价',
      tableData: [
        { headerName: '单据类型', field: 'LYDJMC', width: 100 },
        { headerName: '单号', field: 'LYDJHM', width: 105 },
        { headerName: '开始时间', field: 'KSRQ_SJ', width: 125 },
        { headerName: '工时', field: 'GS', width: 125 },
        { headerName: '耗时', field: 'HS', width: 115 },
        { headerName: '超时', field: 'CS', width: 130 },
        { headerName: '节点状态', field: 'nodeStatus', width: 120 },
        { headerName: '单据状态', field: 'DJZT', width: 140 },
        { headerName: '预计完成时间', field: 'YJWCRQ_SJ', width: 100 },
        { headerName: '完成时间', field: 'WCRQ_SJ', width: 90 },
      ],
      infotable: [
        { headerName: '节点', field: 'JDMC', width: 90 },
        { headerName: '负责人', field: 'ZRR', width: 90 },
        { headerName: '工时', field: 'GS', width: 90 },
        { headerName: '开始时间', field: 'KSRQ_SJ', width: 90 },
        { headerName: '耗时', field: 'HS', width: 90 },
        { headerName: '超时', field: 'CS', width: 90 },
        { headerName: '预计完成时间', field: 'YJWCRQ_SJ', width: 90 },
        { headerName: '完成时间', field: 'WCRQ_SJ', width: 90 },
      ],
    },
    {
      api: 'ipmCLZKForAppService.qryJDDetail',
      tableApi: 'ipmCLZKForAppService.qryMissionSchedule',
      infoApi: 'ipmCLZKForAppService.qryJDJDForOne',
      title: '服务方案',
      tableData: [
        { headerName: '单据类型', field: 'LYDJMC', width: 100 },
        { headerName: '单号', field: 'LYDJHM', width: 105 },
        { headerName: '开始时间', field: 'KSRQ_SJ', width: 125 },
        { headerName: '工时', field: 'GS', width: 120 },
        { headerName: '耗时', field: 'HS', width: 110 },
        { headerName: '超时', field: 'CS', width: 130 },
        { headerName: '下一步', field: 'XYBSM', width: 120 },
        { headerName: '预计完成时间', field: 'YJWCRQ_SJ', width: 140 },
        { headerName: '完成时间', field: 'WCRQ_SJ', width: 100 },
        { headerName: '原因反馈', field: 'YUANYIN', width: 90 },
      ],
      infotable: [
        { headerName: '节点', field: 'JDMC', width: 90 },
        { headerName: '负责人', field: 'ZRR', width: 90 },
        { headerName: '工时', field: 'GS', width: 90 },
        { headerName: '开始时间', field: 'KSRQ_SJ', width: 90 },
        { headerName: '耗时', field: 'HS', width: 90 },
        { headerName: '超时', field: 'CS', width: 90 },
        { headerName: '预计完成时间', field: 'YJWCRQ_SJ', width: 90 },
        { headerName: '完成时间', field: 'WCRQ_SJ', width: 90 },
      ],
    },
    {
      api: 'ipmCLZKForAppService.qryPJBJ',
      tableApi: 'ipmCLZKForAppService.qryPJBJJDXX',
      infoApi: 'ipmCLZKForAppService.qryDHJDXXItem',
      title: '配件报价',
      tableData: [
        { headerName: '单据类型', field: 'LYDJMC', width: 100 },
        { headerName: '单号', field: 'LYDJHM', width: 105 },
        { headerName: '开始时间', field: 'KSRQ_SJ', width: 125 },
        { headerName: '工时', field: 'GS', width: 120 },
        { headerName: '耗时', field: 'HS', width: 110 },
        { headerName: '超时', field: 'CS', width: 130 },
        { headerName: '状态', field: 'DJZT', width: 120 },
        { headerName: '下一步', field: 'XYBSM', width: 115 },
        { headerName: '预计完成时间', field: 'YJWCRQ_SJ', width: 140 },
        { headerName: '完成时间', field: 'WCRQ_SJ', width: 100 },
      ],
      infotable: [
        { headerName: '节点', field: 'JDMC', width: 90 },
        { headerName: '负责人', field: 'ZRR', width: 90 },
        { headerName: '工时', field: 'GS', width: 90 },
        { headerName: '开始时间', field: 'KSRQ_SJ', width: 90 },
        { headerName: '耗时', field: 'HS', width: 90 },
        { headerName: '超时', field: 'CS', width: 90 },
        { headerName: '预计完成时间', field: 'YJWCRQ_SJ', width: 90 },
        { headerName: '完成时间', field: 'WCRQ_SJ', width: 90 },
      ],
    },
    {
      api: 'ipmCLZKForAppService.qryYHGZ',
      title: '要货跟踪',
    },
    {
      api: 'ipmCLZKForAppService.getNSJDDetails',
      tableApi: 'ipmCLZKForAppService.getCarForNSJD',
      infoApi: 'ipmCLZKForAppService.getDSJDXX',
      title: '年审',
      tableData: [
        { headerName: '单据类型', field: 'LYDJMC', width: 100 },
        { headerName: '单号', field: 'LYDJHM', width: 105 },
        { headerName: '开始时间', field: 'KSRQ_SJ', width: 125 },
        { headerName: '工时', field: 'GS', width: 120 },
        { headerName: '耗时', field: 'HS', width: 110 },
        { headerName: '超时', field: 'CS', width: 130 },
        { headerName: '下一步', field: 'XYBSM', width: 120 },
        { headerName: '预计完成时间', field: 'YJWCRQ_SJ', width: 140 },
        { headerName: '完成时间', field: 'WCRQ_SJ', width: 100 },
        { headerName: '原因反馈', field: 'YUANYIN', width: 90 },
      ],
      infotable: [
        { headerName: '节点', field: 'DJLXMC', width: 90 },
        { headerName: '负责人', field: 'DSBJDH', width: 90 },
        { headerName: '工时', field: 'GS', width: 90 },
        { headerName: '开始时间', field: 'KSRQ_SJ', width: 90 },
        { headerName: '耗时', field: 'HS', width: 90 },
        { headerName: '超时', field: 'CS', width: 90 },
        { headerName: '预计完成时间', field: 'YJWCRQ_SJ', width: 90 },
        { headerName: '完成时间', field: 'WCRQ_SJ', width: 90 },
      ],
    },
    {
      api: 'ipmCLZKForAppService.qryWJSJC',
      title: '未结算交车',
    },
    {
      api: 'ipmCLZKForAppService.qryDSK',
      title: '收款',
    },
    {
      api: 'ipmCLZKForAppService.getZJHEAD',
      tableApi: 'ipmCLZKForAppService.getZJLB',
      title: '质检',
      tableData: [
        { headerName: '节点', field: 'JDMC', width: 115 },
        { headerName: '负责人', field: 'ZRR', width: 160 },
        { headerName: '工时', field: 'GS', width: 140 },
        { headerName: '开始时间', field: 'KSRQ_SJ', width: 120 },
        { headerName: '耗时', field: 'HS', width: 150 },
        { headerName: '超时', field: 'CS', width: 135 },
        { headerName: '预计完成时间', field: 'YJWCRQ_SJ', width: 160 },
        { headerName: '完成时间', field: 'WCRQ_SJ', width: 100 },
      ],
    },
  ];

  cryDataOne = [
    {
      api: 'ipmCLZKForAppService.qryGDJDHEAD',
      tableApi: 'ipmCLZKForAppService.qryGDZTRWJD',
      infoApi: 'ipmCLZKForAppService.qryGDBP',
      title: '服务工单',
      tableData: [
        { headerName: '施工方', field: 'SGF', width: 90 },
        { headerName: '工单号', field: 'LYDJHM', width: 120 },
        { headerName: '商品', field: 'SPMC', width: 120 },
        { headerName: '开始时间', field: 'KSRQ_SJ', width: 120 },
        { headerName: '工时', field: 'GS', width: 80 },
        { headerName: '耗时', field: 'HS', width: 80 },
        { headerName: '超时', field: 'CS', width: 80 },
        { headerName: '状态', field: 'SGZT', width: 130 },
        { headerName: '下一步', field: 'XYBSM', width: 115 },
        { headerName: '预计完成时间', field: 'YJWCRQ_SJ', width: 120 },
        { headerName: '完成时间', field: 'WCRQ_SJ', width: 105 },
      ],
      infotable: [
        { headerName: '节点', field: 'JDMC', width: 90 },
        { headerName: '负责人', field: 'ZRR', width: 90 },
        { headerName: '工时', field: 'GS', width: 90 },
        { headerName: '开始时间', field: 'KSRQ_SJ', width: 90 },
        { headerName: '耗时', field: 'HS', width: 90 },
        { headerName: '超时', field: 'CS', width: 90 },
        { headerName: '预计完成时间', field: 'YJWCRQ_SJ', width: 90 },
        { headerName: '完成时间', field: 'WCRQ_SJ', width: 90 },
      ],
    },
    {
      api: 'ipmCLZKForAppService.qryWLPS',
      tableApi: 'ipmCLZKForAppService.qryAll_WLPSJDXX',
      infoApi: 'ipmCLZKForAppService.qryDHJDXXItem',
      title: '物流配送',
      tableData: [
        { headerName: '单据类型', field: 'LYDJMC', width: 90 },
        { headerName: '单号', field: 'LYDJHM', width: 120 },
        { headerName: '商品', field: 'SPMC', width: 120 },
        { headerName: '开始时间', field: 'KSRQ_SJ', width: 120 },
        { headerName: '工时', field: 'GS', width: 80 },
        { headerName: '耗时', field: 'HS', width: 80 },
        { headerName: '超时', field: 'CS', width: 80 },
        { headerName: '状态', field: 'DJZT', width: 130 },
        { headerName: '下一步', field: 'XYBSM', width: 115 },
        { headerName: '预计完成时间', field: 'YJWCRQ_SJ', width: 120 },
        { headerName: '完成时间', field: 'WCRQ_SJ', width: 105 },
      ],
      infotable: [
        { headerName: '节点', field: 'JDMC', width: 90 },
        { headerName: '负责人', field: 'ZRR', width: 90 },
        { headerName: '工时', field: 'GS', width: 90 },
        { headerName: '开始时间', field: 'KSRQ_SJ', width: 90 },
        { headerName: '耗时', field: 'HS', width: 90 },
        { headerName: '超时', field: 'CS', width: 90 },
        { headerName: '预计完成时间', field: 'YJWCRQ_SJ', width: 90 },
        { headerName: '完成时间', field: 'WCRQ_SJ', width: 90 },
      ],
    },
    {
      api: 'ipmCLZKForAppService.qryZZZ',
      tableApi: 'ipmCLZKForAppService.qryAll_ZZZ',
      infoApi: 'ipmCLZKForAppService.qryDHJDXXItem',
      title: '中转站',
      tableData: [
        { headerName: '单据类型', field: 'LYDJMC', width: 90 },
        { headerName: '单号', field: 'LYDJHM', width: 120 },
        { headerName: '商品', field: 'SPMC', width: 120 },
        { headerName: '开始时间', field: 'KSRQ_SJ', width: 120 },
        { headerName: '工时', field: 'GS', width: 80 },
        { headerName: '耗时', field: 'HS', width: 80 },
        { headerName: '超时', field: 'CS', width: 80 },
        { headerName: '状态', field: 'DJZT', width: 130 },
        { headerName: '下一步', field: 'XYBSM', width: 115 },
        { headerName: '预计完成时间', field: 'YJWCRQ_SJ', width: 120 },
        { headerName: '完成时间', field: 'WCRQ_SJ', width: 105 },
      ],
      infotable: [
        { headerName: '节点', field: 'JDMC', width: 90 },
        { headerName: '负责人', field: 'ZRR', width: 90 },
        { headerName: '工时', field: 'GS', width: 90 },
        { headerName: '开始时间', field: 'KSRQ_SJ', width: 90 },
        { headerName: '耗时', field: 'HS', width: 90 },
        { headerName: '超时', field: 'CS', width: 90 },
        { headerName: '预计完成时间', field: 'YJWCRQ_SJ', width: 90 },
        { headerName: '完成时间', field: 'WCRQ_SJ', width: 90 },
      ],
    },
    {
      api: 'ipmCLZKForAppService.qryXDD',
      tableApi: 'ipmCLZKForAppService.qryAll_XDD',
      infoApi: 'ipmCLZKForAppService.qryDHJDXXItem',
      title: '下订单',
      tableData: [
        { headerName: '单据类型', field: 'LYDJMC', width: 90 },
        { headerName: '单号', field: 'LYDJHM', width: 120 },
        { headerName: '商品', field: 'SPMC', width: 120 },
        { headerName: '开始时间', field: 'KSRQ_SJ', width: 120 },
        { headerName: '工时', field: 'GS', width: 80 },
        { headerName: '耗时', field: 'HS', width: 80 },
        { headerName: '超时', field: 'CS', width: 80 },
        { headerName: '状态', field: 'DJZT', width: 130 },
        { headerName: '下一步', field: 'XYBSM', width: 115 },
        { headerName: '预计完成时间', field: 'YJWCRQ_SJ', width: 120 },
        { headerName: '完成时间', field: 'WCRQ_SJ', width: 105 },
      ],
      infotable: [
        { headerName: '节点', field: 'JDMC', width: 90 },
        { headerName: '负责人', field: 'ZRR', width: 90 },
        { headerName: '工时', field: 'GS', width: 90 },
        { headerName: '开始时间', field: 'KSRQ_SJ', width: 90 },
        { headerName: '耗时', field: 'HS', width: 90 },
        { headerName: '超时', field: 'CS', width: 90 },
        { headerName: '预计完成时间', field: 'YJWCRQ_SJ', width: 90 },
        { headerName: '完成时间', field: 'WCRQ_SJ', width: 90 },
      ],
    },
  ];
}

